﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CSharp.Study.Test
{
    public class Event事件
    {
        public static void Go()
        {

        }



    }

    /// <summary>
    /// 发布器类
    /// </summary>
    public class EventTest
    {
        private int value;

        public delegate void NumberChangeHandler();

        public event NumberChangeHandler NumberChangeEvent;


        /// <summary>
        /// 定义触发事件执行的方法
        /// </summary>
        protected virtual void OnNumberChanged()
        {
            if(NumberChangeEvent != null)
                NumberChangeEvent();//触发事件
            else
                Console.WriteLine("事件未触发");
        }

    }
}
